/**
 * @author 董一华
 * @since 1.00
 * @version 1.00
 * 
 * 关闭窗口按钮控件
 * 使用说明：
 * jsp中使用范例：<htdz-tag:ButtonCloseWinTag/>
 * 
 * 参数说明：
 * 1. hide是否隐藏,可选值:true,false。缺省值为false
 * 
 * 修订列表： v1.00 2009-11-12 
 * 			修订人：董一华 
 * 			修订内容：初始版本
 * 
 */

package com.zjht.gmcc.bean.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import com.zjht.gmcc.bean.util.MyFormat;

public class ButtonCloseWinTag extends TagSupport {
	private static final long serialVersionUID = 7343418033252888637L;
	private boolean hide;
	
	public ButtonCloseWinTag() {
	}

	@SuppressWarnings("static-access")
	public int doStartTag() throws JspException {
		boolean hide = this.hide;
		StringBuilder html = new StringBuilder();

		try {
			html.append("<input id=\"closewin__\" type=\"button\" onclick=\"javascript:hideAllDiv();window.close();\" ");
			html.append(MyFormat.getButtonClass("返 回"));
			if(hide){
				html.append(" style=\"display:none\"");
			}
			html.append(" />");
			pageContext.getOut().print(html.toString());
		} catch (Exception e) {
			throw new JspException(e.getMessage());
		}
		html=null;
		return this.SKIP_BODY;
	}
	
	public void setHide(boolean hide) {
		this.hide = hide;
	}

	public void setHide(String hide) {
		this.hide = (hide != null && "true".equals(hide.trim().toLowerCase()));
	}
}
